Dlock

Section: Mar. 8, 1992 (2)
Updated: MiNT Programmer's Manual
Index Return to Main Contents
 

NAME

Dlock - lock or unlock a BIOS disk device  

SYNOPSIS

LONG Dlock( WORD mode, WORD drv );
 

DESCRIPTION

Dlock is used to lock or unlock the BIOS device indicated by drv. No GEMDOS file operations are permitted on a locked drive. Thus, the Dlock call provides a mechanism for disk formatters or re-organizers to lock out other processes while low-level BIOS or XBIOS operations are in progress on the device.

If mode is 1, the drive is locked; if it is 0 then the drive is unlocked and may be used again by other programs. If a process terminates while holding a lock on a drive, that drive is automatically unlocked.

A lock operation followed immediately by an unlock is very similar to a media change, except that the lock operation will fail if there are open files that refer to the indicated drive.  

RETURNS

0 if the lock/unlock operation was successful

EACCDN if mode is 1 and either open files exist on the drive or another process is searching a directory on the drive

ELOCKED if mode is 1 and another process has locked the drive.

ENSLOCK if mode is 0 and the drive was not locked by this process

EDRIVE if drv is not a valid BIOS device number  

SEE ALSO

Fxattr(2)  

NOTES

Note that Dlock operates on BIOS devices, which may not always be in 1-1 correspondence with GEMDOS drive letters. For this reason, to lock GEMDOS drive A: (for example), the programmer should call Fxattr on the root directory of A: ("A:\") and then use the dev field of the structure returned in order to determine the BIOS device corresponding to the GEMDOS drive.


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURNS
SEE ALSO
NOTES

This document was created by man2html, using the manual pages.
Time: 16:01:23 GMT, March 03, 2023